<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="box">rrrr</div>
    <script>
        var box=document.querySelector("#box")
        console.log(box);

        var xhr=new XMLHttpRequest();
        xhr.open("GET","./04_json.php");
        xhr.send();
        xhr.onreadystatechange=function(){
            if(xhr.readyState===4){
                var obj=JSON.parse(xhr.responseText);
                var html="";
                for(var attr in obj){
                    html+=`<p>key的值为：attr;value值为${obj[attr]}</p>`;
                }
                box.innerHTML=html
            }
        }
    </script>
</body>
</html>